#ifndef UPDATE_DOWNLOADWINDOW_H
#define UPDATE_DOWNLOADWINDOW_H

#include <QMainWindow>
#include <QProgressBar>
#include <QNetworkRequest>
class QPushButton;
class QNetworkAccessManager;
class QNetworkReply;
class QLabel;
class QFile;
class QTimer;
namespace bap {
	class DownloadWindow :public QMainWindow {
		Q_OBJECT
	public:
		DownloadWindow(QWidget *parent = 0);
		~DownloadWindow();
		public slots:
		void ReplyFinishedSlot(QNetworkReply*reply);
		void onDownloadProgress(qint64, qint64);
		void onReadyRead();
		void onfinished();
		void timerUpDate();
		void setVersion(std::string version) { m_version = version; }
	protected:
		void showEvent(QShowEvent* event);
	private:
		void Download(QStringList list);

		QLabel* m_MessageLabel;
		QProgressBar *m_ProgressBar;
		QPushButton* m_Update;
		QPushButton* m_Cancel;

		QNetworkAccessManager*m_AccessManager;
		QNetworkRequest m_Request;
		QNetworkReply *m_Reply;
		QFile *m_File;
		QTimer *m_Timer;
		std::string m_version;
	};
}


#endif // !UPDATE_DOWNLOADWINDOW_H
